﻿
Partial Class WebForm_SearchControl_SearchDirtyHeaderControl
    Inherits System.Web.UI.UserControl

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        'If Not IsPostBack Then
        'Else
        '    Me.InitDataAndShow()
        'End If

        Me.Visible = False
    End Sub

    Protected Sub gv_RowCommand(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCommandEventArgs)


    End Sub


    Public Event SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs)


    Protected Sub GV_PageIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles GV.PageIndexChanged
        Me.InitDataAndShow()
    End Sub

    Protected Sub GV_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles GV.SelectedIndexChanged
        'FindDirtyHeaderID
        Me.SelectedValue = Me.GV.SelectedValue
        Me.SelectedText = Me.GV.SelectedRow.Cells(0).Text
        RaiseEvent SelectedIndexChanged(Me, New EventArgs)
    End Sub

    Protected Sub btnShowAll_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnShowAll.Click
        Me.ShowAll = True
        Me.ObjectDataSource1.SelectParameters("ShowAll").DefaultValue = Me.ShowAll
        Me.GV.DataBind()
        Me.InitDataAndShow()
    End Sub
End Class

Partial Class WebForm_SearchControl_SearchDirtyHeaderControl
    Public Sub InitDataAndShow()
        'GV.DataSourceID = ObjectDataSource1.ID
        Me.Visible = True
        Me.mpSearch.Show()
    End Sub


    Public Property SelectedValue() As String
        Get
            Return ViewState("SelectedValue")
        End Get
        Set(ByVal value As String)
            ViewState("SelectedValue") = value
        End Set
    End Property

    Public Property SelectedText() As String
        Get
            Return ViewState("SelectedText")
        End Get
        Set(ByVal value As String)
            ViewState("SelectedText") = value
        End Set
    End Property

    Protected Property ShowAll() As Boolean
        Get
            If ViewState("ShowAll") Is Nothing Then
                ViewState("ShowAll") = False
            End If

            Return ViewState("ShowAll")
        End Get
        Set(ByVal value As Boolean)
            ViewState("ShowAll") = value
        End Set
    End Property
End Class